<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

include_once 'class.phpmailer.php';

function sendMail($para,$assunto,$mensagem)

{

$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch

$mail->IsSMTP(); // telling the class to use SMTP

try {
    $mail->SetLanguage('br');
//  $mail->Host       = "mail.yourdomain.com"; // SMTP server
  $mail->SMTPDebug  = 0;                     // enables SMTP debug information (for testing use 2)
  $mail->SMTPAuth   = true;                  // enable SMTP authentication
  $mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
  $mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
  $mail->Port       = 465;                   // set the SMTP port for the GMAIL server
  $mail->Username   = "gomes.dc@gmail.com";  // GMAIL username
  $mail->Password   = "da4631";            // GMAIL password
//  $mail->AddReplyTo('name@yourdomain.com', 'First Last');
  $mail->AddAddress($para);
  $mail->SetFrom('gomes.dc@gmail.com', 'Daniel Gomes');
//  $mail->AddReplyTo('name@yourdomain.com', 'First Last');
  $mail->Subject = $assunto;
  $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
  $mail->IsHTML(TRUE);
  $mail->MsgHTML($mensagem);
//  $mail->AddAttachment('images/phpmailer.gif');      // attachment
//  $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
  $mail->Send();
  echo "Message Sent OK</p>\n";
} catch (phpmailerException $e) {
//  echo $e->errorMessage(); //Pretty error messages from PHPMailer
        throw $e;
} catch (Exception $e) {
//  echo $e->getMessage(); //Boring error messages from anything else!
    throw $e;
}

		

} 
?>
